'use strict';
var _ = require('lodash');
var db = require('../models');

var cmds = {
  createVendor: ['name', 'loc', 'addr', 'bizHoursStart', 'bizHoursEnd', 'tel']
}

function add(body, callback) {
  var cmd = _.pick(body, cmds.createVendor);
  cmd.locId = '';
  db.vendor.create(cmd).then(function (vendor) {
    return callback(null, vendor.dataValues);
  }).catch(function (err) {
    return callback(err);
  });
}

exports.add = add;
